package gui.utils;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;

import javax.swing.JPanel;
import javax.swing.UIManager;

public class DegradedPanel extends JPanel{

	private Color couleur1;
	private Color couleur2;
	public DegradedPanel(Color c1,Color c2){
		super();
		couleur1 = c1;
		couleur2 = c2;
	}
	
	 public void paintComponent(Graphics g) {
			super.paintComponent(g);
			//if (!isOpaque()) {
			 //   return;
			//}

			Color control = UIManager.getColor("control");
			int width = getWidth();
			int height = getHeight();

			Graphics2D g2 = (Graphics2D) g;
			Paint storedPaint = g2.getPaint();
			g2.setPaint(new GradientPaint(500,700, couleur1,
				(2 * getWidth() / 3), 1000, couleur2));
			g2.fillRect(0, 0, width, height);
			g2.setPaint(storedPaint);
		    }
}
